package com.xuyoupeng.springframework.context.support;

import com.xuyoupeng.springframework.beans.factory.config.BeanDefinition;
import com.xuyoupeng.springframework.beans.factory.support.DefaultListableBeanFactory;
import com.xuyoupeng.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.beans.BeansException;

import java.util.Map;

/**
 * @author xuyoupneg
 * @description TODO
 * @date 2024/3/20 21:40
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocations = getConfigLocations();
        if (null != configLocations) {
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    protected abstract String[] getConfigLocations();
}
